﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Hsinchu.BLL;
using DevExpress.Web.ASPxEditors;

public partial class Admin_OrderMgr_OrderList : System.Web.UI.Page
{
    OrderMgr dllOrderMgr = new OrderMgr();
    UserInfoMgr dllUserInfoMgr = new UserInfoMgr();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            InitLoad();
        }
    }

    /// <summary>
    /// 初始化载入
    /// </summary>
    void InitLoad()
    {
        BindOrderListGridView();
    }

    /// <summary>
    /// 绑定订单列表
    /// </summary>
    void BindOrderListGridView()
    {
        this.OrderGridView.DataSource = dllOrderMgr.GetOrder();
        this.OrderGridView.DataBind();
    }

    void BindProductInfoGridView()
    {
        
    }

    
    

   
    /// <summary>
    /// 订单收货信息查看事件
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnView_Click1(object sender, EventArgs e)
    {
        //得到button所在行        
        ASPxButton bt = (ASPxButton)sender;//获得当前控件
        TableCell cell = (TableCell)bt.Parent;//得到所处的父单元格
        GridViewRow iRow = (GridViewRow)cell.Parent;//得到所处父单元行
        int _rowIndex = iRow.RowIndex;//得到该行的索引
        int userid= Convert.ToInt32(this.OrderGridView.DataKeys[0]["ReceiveAddressId"].ToString());
        DataTable dtReceiveAddress = dllUserInfoMgr.GetUserInfoByUserId(userid);
        if (dtReceiveAddress.Rows.Count > 0)
        {
            this.lDealingPeople.Text = dtReceiveAddress.Rows[0]["DealingPeople"].ToString();
            this.lEmail.Text = dtReceiveAddress.Rows[0]["Email"].ToString();
            this.lMobile.Text = dtReceiveAddress.Rows[0]["Mobile"].ToString();
            this.lPostcode.Text = dtReceiveAddress.Rows[0]["PostCode"].ToString();
            this.lReceiveAddress.Text = dtReceiveAddress.Rows[0]["ReceiveAddress"].ToString();
            this.lTel.Text = dtReceiveAddress.Rows[0]["Tel"].ToString();
        }
    }
   
}
